@import '../common/style/var.less';

.van-tabs {
  position: relative;
  -webkit-tap-highlight-color: transparent;

  &__wrap {
    display: flex;
    overflow: hidden;

    &--scrollable {
      .van-tab {
        flex: 0 0 22%;

        &--complete {
          flex: 1 0 auto !important;
          padding: 0 @padding-sm;
        }
      }

      .van-tabs__nav {
        &--complete {
          padding-right: 8px;
          padding-left: 8px;
        }
      }
    }
  }

  &__scroll {
    background-color: var(
      --tabs-nav-background-color,
      @tabs-nav-background-color
    );
    overflow: auto;

    &--line {
      box-sizing: content-box;
      // 15px padding to hide scrollbar in mobile safari
      height: calc(100% + 15px);
    }

    &--card {
      box-sizing: border-box;
      margin: 0 var(--padding-md, @padding-md);
      border: @border-width-base solid
        var(--tabs-default-color, @tabs-default-color);
      width: calc(100% - calc(var(--padding-md, @padding-md) * 2));
      border-radius: @border-radius-sm;
    }

    &::-webkit-scrollbar {
      display: none;
    }
  }

  &__nav {
    position: relative;
    display: flex;
    user-select: none;

    &--card {
      box-sizing: border-box;
      height: var(--tabs-card-height, @tabs-card-height);

      .van-tab {
        color: var(--tabs-default-color, @tabs-default-color);
        line-height: calc(
          var(--tabs-card-height, @tabs-card-height) - 2 * @border-width-base
        );
        border-right: @border-width-base solid
          var(--tabs-default-color, @tabs-default-color);

        &:last-child {
          border-right: none;
        }

        &.van-tab--active {
          color: @white;
          background-color: var(--tabs-default-color, @tabs-default-color);
        }

        &--disabled {
          color: var(--tab-disabled-text-color, @tab-disabled-text-color);
        }
      }
    }
  }

  &__line {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 1;
    opacity: 0;
    height: var(--tabs-bottom-bar-height, @tabs-bottom-bar-height);
    border-radius: var(--tabs-bottom-bar-height, @tabs-bottom-bar-height);
    background-color: var(--tabs-bottom-bar-color, @tabs-bottom-bar-color);
  }

  &__track {
    position: relative;
    width: 100%;
    height: 100%;

    &--animated {
      display: flex;
      transition-property: left;
    }
  }

  &__content {
    overflow: hidden;
  }

  &--line {
    height: var(--tabs-line-height, @tabs-line-height);
  }

  &--card {
    height: var(--tabs-card-height, @tabs-card-height);
  }
}

.van-tab {
  position: relative;
  flex: 1;
  box-sizing: border-box;
  min-width: 0; /* hack for flex ellipsis */
  padding: 0 5px;
  text-align: center;
  cursor: pointer;
  color: var(--tab-text-color, @tab-text-color);
  font-size: var(--tab-font-size, @tab-font-size);
  line-height: var(--tabs-line-height, @tabs-line-height);

  &--active {
    font-weight: var(--font-weight-bold, @font-weight-bold);
    color: var(--tab-active-text-color, @tab-active-text-color);
  }

  &--disabled {
    color: var(--tab-disabled-text-color, @tab-disabled-text-color);
  }

  &__title {
    &__info {
      position: relative !important;
      top: -1px !important;
      transform: translateX(0) !important;
    }
  }
}
